<template>
  <div>
    <div style="width:100%;background-color: #FFFFFF;" >
      <a-tabs size="small" @change="callback">
        <a-tab-pane key="1" v-if="personStageFun(1)" tab="签到信息">
          <sign ref="sign"></sign>
        </a-tab-pane>
        <a-tab-pane key="2" v-if="personStageFun(2)" tab="吸毒检测" forceRender>
          <check ref="checks"></check>
        </a-tab-pane>
        <a-tab-pane key="3" v-if="personStageFun(3)" tab="定期访谈" forceRender>
          <interview ref="interview"></interview>
        </a-tab-pane>
        <a-tab-pane key="4" v-if="personStageFun(4)" tab="帮教谈心" forceRender>
          <cose ref="cose"></cose>
        </a-tab-pane>
        <a-tab-pane key="5" v-if="personStageFun(5)" tab="帮扶救助" forceRender>
          <succour ref="succour"></succour>
        </a-tab-pane>
        <a-tab-pane key="6" v-if="personStageFun(6)" tab="职业技能培训" forceRender>
          <training ref="training"></training>
        </a-tab-pane>
        <a-tab-pane key="7" v-if="personStageFun(7)" tab="就业安置" forceRender>
          <aftercare ref="aftercare"></aftercare>
        </a-tab-pane>
        <a-tab-pane key="8" v-if="personStageFun(8)" tab="法律援助" forceRender>
          <aid ref="aid"></aid>
        </a-tab-pane>
        <a-tab-pane key="9" v-if="personStageFun(9)" tab="心里咨询" forceRender>
          <consult ref="consult"></consult>
        </a-tab-pane>
        <a-tab-pane key="10" tab="美沙酮治疗" v-if="personStageFun(10)" forceRender>
          <treat ref="treat"></treat>
        </a-tab-pane>
        <a-tab-pane key="11" tab="社区/小组活动" v-if="personStageFun(11)" forceRender>
          <activity ref="activity"></activity>
        </a-tab-pane>
      </a-tabs>
    </div>
  </div>

</template>

<script>
import sign from '@views/sjsk/holographicArchives/modules/intervene/sign'
import check from "@views/sjsk/holographicArchives/modules/intervene/check";
import interview from "@views/sjsk/holographicArchives/modules/intervene/interview";
import cose from "@views/sjsk/holographicArchives/modules/intervene/cose";
import succour from "@views/sjsk/holographicArchives/modules/intervene/succour";
import training from "@views/sjsk/holographicArchives/modules/intervene/training";
import aftercare from "@views/sjsk/holographicArchives/modules/intervene/aftercare";
import aid from "@views/sjsk/holographicArchives/modules/intervene/aid";
import consult from "@views/sjsk/holographicArchives/modules/intervene/consult";
import treat from "@views/sjsk/holographicArchives/modules/intervene/treat";
import activity from "@views/sjsk/holographicArchives/modules/intervene/activity";

export default {
  name: "index",
  components:{sign,check,interview,cose,succour,training,aftercare,aid,consult,treat,activity},
  data(){
    return {
      defaultActiveKey:'1',
    }
  },
  methods:{
    refreshTable(){
      console.log('介入')
    },
    personStageFun(val){
      // return this.$store.state.routeObjData === val
      // console.log(this.$store.state)
      // console.log(this.$store.state.holographicArchives.routeObjData)
      if(this.$store.state.holographicArchives.routeObjData){
        if(this.$store.state.holographicArchives.routeObjData.personStage === 1 || this.$store.state.holographicArchives.routeObjData.personStage === '1'){
          return val === 4||val === 5||val === 8||val === 9||val === 10;
        }
        if(this.$store.state.holographicArchives.routeObjData.personStage === 2 || this.$store.state.holographicArchives.routeObjData.personStage === '2'){
          return true
        }
        if(this.$store.state.holographicArchives.routeObjData.personStage === 3 || this.$store.state.holographicArchives.routeObjData.personStage === 3){
          return val === 4||val === 5||val === 6||val === 7||val === 11;
        }
      } else {
        console.log('请检查VUEX数据')
        return true
      }
    },
    callback(key) {
      console.log(key)
      switch(key){
        case '1':
          this.$refs.sign.refreshTable()

          break
        case '2':
          this.$refs.checks.refreshTable()
          // this.$refs.checks.a()

          break
        case '3':
          this.$refs.interview.onQuery()

          break
        case '4':
          this.$refs.cose.getRouter()

          break
        case '5':
          this.$refs.succour.refreshTable()

          break
        case '6':
          this.$refs.training.refreshTable()

          break
        case '7':
          this.$refs.aftercare.refreshTable()

          break
        case '8':
          this.$refs.aid.refreshTable()

          break
        case '9':
          this.$refs.consult.getHistory()

          break
        case '10':
          this.$refs.treat.refreshTable()

          break
        case '11':
          this.$refs.activity.refreshTable()

          break
      }
    },
  }
}
</script>

<style scoped>

</style>